.TH C++SIM 3A "23rd December 2016" "C++SIM" "C++SIM Reference Manual"
.SH NAME
MONITOR_RESET, CHECK_RESET RESET_POINT \- allow resetting of simulation runs.
.SH SYNOPSIS
.B "#ifndef RESET_H_"
.br
.B "#   include <ClassLib/reset.h>
.br
.B "#endif"
.sp
.BI "RESET_POINT"
.sp
.BI "MONITOR_RESET(x,y,z);
.sp
.BI "CHECK_RESET(y,z);
.SH DESCRIPTION
Resetting a simulation involves resetting all of the objects
involved in it which will be required for subsequent runs.
To reset a simulation, the
.B
reset
method of the simulation
.B
scheduler
must be invoked. This then calls the corresponding
.B
reset
methods for all of the process objects which are currently
on the simulation queue.

However, there is a difference between resetting the state
of a process and resetting its associated thread. The thread
can only be reset when it is next activated. Because a reset
can potentially occur at any point, it is necessary for an
active process to be able to determine whether it was reset
while it was inactive, and take appropriate action.

C++SIM provides two macros for this, both based upon the
CSP notion of guarded commands. Operations are performed and
a reset condition can be checked before the process acts upon
the results. If a reset occurs, the
.B
reset
method for the
.B
Process
should be written so that it sets this condition flag to
an appropriate state.

.B
RESET_POINT
is used for specifying the reset position within a
method where the flow of control will be returned to
upon detecting a reset.

.B
MONITOR_RESET(x,y,z)
executes statement
.I
x
and upon completion statements
.I
y
and
.I
z
are compared. If they are equal, then the control flow is
returned to the
.B
RESET_POINT.

.B
CHECK_RESET(y,z)
compares statements
.I
y
and
.I
z
and returns control to the
.B
RESET_POINT
if they are equal.
.SH SEE ALSO
Process(3A), Scheduler(3A)
